<!DOCTYPE html>
<html lang="en" xmlns:v-on="http://www.w3.org/1999/xhtml">
<head>
  <meta charset="UTF-8">
  <title>User -v1</title>
  <link rel="stylesheet" href="../../../lib/bootstrap/3.3.5/css/bootstrap.min.css"/>

  <style type="text/css">
    .site-bgcolor {
      background: AliceBlue
    }

  </style>
</head>
<body>
<div id="app" class="container-fluid">

  <div class="row-fluid">
    <div class="col-sm-12">
      <h3 class="page-header text-center">
        用户管理
        <small>{{modeTitle}} (User Viewer)</small>
      </h3>
    </div>
  </div>

  <div class="row">
    <div class="col-sm-12">
      <br/>
    </div>
  </div>

  <div class="row">
    <div class="collapse col-sm-12" id="advancedsearch">
      <div class="well">
        <div class="row">
          <!-- <form class="form-horizontal contract-form"> -->
          <div class="form-group">

            <label class="col-sm-1 control-label">criterion</label>

            <div class="col-sm-5">
              <input id="begintime" name="begintime" type="text" v-model="criterion" value="2015-01-01" required/>
            </div>

            <label class="col-sm-1 control-label">pagenum</label>

            <div class="col-sm-5">
              <input id="endtime" name="endtime" type="text" v-model="pagenum" value="2015-02-01" required/>
            </div>

          </div>

          <div class="form-group">

            <label class="col-sm-1 control-label">pagesteps</label>

            <div class="col-sm-5">
              <input id="deviceid" name="deviceid" type="text" v-model="pagesteps" value="" class="form-control"
                     required/>
            </div>

          </div>
          <div class="form-group">

            <div class="col-sm-offset-9 col-sm-1">
              <button class="btn btn-outline btn-block btn-warning">清除</button>
            </div>
            <div class="col-sm-2">
              <button id='submitbutton' class="btn btn-outline btn-block btn-success save"
                      v-on:click="advancedsearch($event)">提交
              </button>
            </div>
          </div>
          <!-- </form> -->
        </div>
      </div>
    </div>
  </div>


  <div id="objectviewer" class="row" v-show="mode=='modeItemView'">
    object viewer
  </div>

  <div id="objectlist1" v-show="mode=='modeList'">
    <div class="row">
      <itemsearch :item="curitem" :on-remove="onRemove" :on-add="onAdd"></itemsearch>
      <itemlist :mode="mode" :item="curitem" :items="items" :on-edit="onEdit" :on-remove="onRemove"
                :on-back="backToParent"></itemlist>
    </div>
  </div>

  <div id="objecteditor" v-show="mode=='modeAddNew'">
    <div class="row">
      <itemeditor :mode="mode" :item="curitem" :on-submit="onSave" :on-cancel="onCancel"></itemeditor>
    </div>
  </div>

  <div id="objecteditor2" v-show="mode=='modeEdit'">
    <div class="row">
      <itemeditor :mode="mode" :item="curitem" :on-submit="onSave" :on-cancel="onCancel"></itemeditor>
    </div>
  </div>

  <div id="objectdetails" v-show="mode=='modeDetails'">
    <div class="row">
      <itemdetails :mode="mode" :item="curitem" :on-cancel="onCancel"></itemdetails>
    </div>
  </div>

  <div class="row">
    <div class="col-sm-12">
      <hr/>
    </div>
  </div>

  <div class="row">
    <div class="col-sm-12 text-center">
      <span>{{curdate}}</span>
    </div>
  </div>

  <div class="row">
    <div class="col-sm-12 text-center"><br/></div>
  </div>

  <!--	<pre>
            <div>{{ $curitem | json }}</div>
            <div>{{ $data | json }}</div>
        </pre>-->
</div>
<!-- app -->

<template id="itemsearch-tpl">
  <div class="col-sm-12">
    <div class="col-sm-3">
      <button class="btn btn-default" href="#add" v-on:click="onAdd()">新增</button>
      <button class="btn btn-default" v-on:click="onRemoveSelected()">删除选中记录</button>
    </div>
    <div class="col-sm-offset-3 col-sm-3">
      <input id="searchQuery" name="query" type="text" style="float:right" v-model="searchQuery" class="form-control"
             required/>
    </div>
    <div class="col-sm-2">
      <button id='search' class="btn btn-outline btn-block btn-success save" v-on:click="basicsearch($event)"><strong>搜索全部</strong>
      </button>
    </div>
    <div class="col-sm-1 text-left vertical-middle-sm">
      <h5><strong>
        <a role="button" class="control-label" data-toggle="collapse" href="#advancedsearch" aria-expanded="false"
           aria-controls="advancedsearch">高级...</a>
      </strong></h5>
    </div>
  </div>
</template>
<!--/itemsearch-tpl-->

<template id="itemeditor-tpl">
  <div class="col-sm-12">
    <!-- <form class="form-horizontal"> -->
    <div class="form-horizontal">
      <div class="site-bgcolor">
        <hr/>
        <div class="form-group">
          <label for="id" class="col-sm-1 control-label">唯一标识</label>

          <div class="col-sm-4">
            <input class="form-control" id="id" v-model="item.id" disabled>
          </div>
        </div>

        <div class="form-group">
          <label for="code" class="col-sm-1 control-label">昵称</label>

          <div class="col-sm-4">
            <input class="form-control" id="code" v-model="item.code">
          </div>
        </div>

        <div class="form-group" >
          <label for="password" class="col-sm-1 control-label">密码</label>

          <div class="col-sm-4">
            <input  class="form-control" id="password" v-model="item.password">
          </div>
        </div>

        <div class="form-group">
          <label for="phone" class="col-sm-1 control-label">电话</label>

          <div class="col-sm-4">
            <input class="form-control" id="phone" v-model="item.phone">
          </div>
        </div>
        <div class="form-group">
          <label for="email" class="col-sm-1 control-label">邮箱</label>

          <div class="col-sm-4">
            <input class="form-control" id="email" v-model="item.email">
          </div>
        </div>
        <div class="form-group">
          <label for="securityquestions" class="col-sm-1 control-label">安全问题</label>

          <div class="col-sm-4">
            <input class="form-control" id="securityquestions" v-model="item.securityquestions">
          </div>
        </div>
        <div class="form-group" >
          <label for="securityanswers" class="col-sm-1 control-label">安全答案</label>

          <div class="col-sm-4">
            <input class="form-control" id="securityanswers" v-model="item.securityanswers">
          </div>
        </div>
        <div class="form-group" v-if="mode=='modeAddNew'">
          <label for="crtuser" class="col-sm-1 control-label">创建者名称</label>

          <div class="col-sm-4">
            <input class="form-control" id="crtuser" v-model="item.crtuser">
          </div>
        </div>
        <div class="form-group" v-if="mode=='modeEdit'">
          <label for="upduser" class="col-sm-1 control-label">更新者名称</label>

          <div class="col-sm-4">
            <input class="form-control" id="upduser" v-model="item.upduser">
          </div>
        </div>

        <div class="form-group">
          <div class="col-sm-3 col-md-push-9">
            <button class="btn btn-default" v-on:click="onCancelClick($event)">取消</button>
            &nbsp;&nbsp;&nbsp;
            <button class="btn btn-default" v-on:click="onSubmitClick($event)">提交</button>
          </div>
        </div>
      </div>
    </div>
    <!-- </form> -->
  </div>
</template>

<template id="itemlist-tpl" class="container-fluid">
  <div class="table-responsive col-sm-12">
    <ul class="media-list row contacts-container"></ul>
    <table class="table table-bordered table-condensed table-striped" style="word-break:break-all">
      <thead>
      <tr class="info">
        <th>选择</th>
        <th>唯一标识</th>
        <th>昵称</th>
        <th>创建者</th>
        <th>联系电话</th>
        <th>邮箱</th>
        <th>状态</th>
        <th>操作</th>
      </tr>
      </thead>
      <tbody>
      <tr v-for="item in items">
        <td><input type="checkbox" v-model="item.selected"></td>
        <td><a href="#details" v-on:click="onDetailsItem('modeDetails',item)">{{item.id}}</a>
        <td>{{item.code}}</td>
        <td>{{item.crtuser}}</td>
        <td>{{item.phone}}</td>
        <td>{{item.email}}</td>

        <td v-if="item.objectstate==0">申请中</td>
        <td v-if="item.objectstate==1">已激活</td>
        <td v-if="item.objectstate==9">已失效</td>
        <td>
          <a href="#" v-on:click="onRemoveItem(item,$event)"> 删除 </a> |
          <a href="#" v-on:click="onEditItem(item,$event)"> 编辑 </a>
        </td>
      </tr>
      </tbody>
    </table>

  </div>
</template>

<template id="itemdetails-tpl" class="container-fluid">

  <div class="row show-grid" align="center">
    <img src="http://euvee.vicp.co/file?filename=681d84ee-2bff-437c-b304-ba7aa2e378b8.JPG&day=20160628"
         class="img-circle" width="150" height="150">
  </div>
  <br/>
  <br/>

  <div class="row show-grid">
    <div class="col-lg-1 col-md-offset-3">
      <h3><strong>唯一标识：</strong></h3>

      <h3><strong>昵称：</strong>
      </h3>

      <h3><strong>联系电话：</strong>
      </h3>

      <h3><strong>邮箱：</strong>
      </h3>

      <h3><strong>密码：</strong>
      </h3>

      <h3><strong>状态：</strong>
      </h3>

      <h3><strong>终止日期：</strong>
      </h3>

      <h3><strong>安全问题：</strong>
      </h3>

      <h3><strong>安全答案：</strong>
      </h3>

      <h3><strong>创建日期：</strong>
      </h3>

      <h3><strong>更新日期：</strong>
      </h3>

      <h3><strong>创建者：</strong>
      </h3>

      <h3><strong>更新者：</strong>
      </h3>
    </div>
    <div class="col-lg-6">
      <h3>{{item.id}}</h3>

      <h3>{{item.code}}</h3>

      <h3>{{item.phone}}</h3>

      <h3>{{item.email}}</h3>

      <h3>{{item.password}}</h3>

      <h3>{{item.objectstate}}</h3>

      <h3>{{item.expireon}}</h3>

      <h3>{{item.securityquestions}}</h3>

      <h3>{{item.securityanswers}}</h3>

      <h3>{{item.crtdate}}</h3>

      <h3>{{item.upddate}}</h3>

      <h3>{{item.crtuser}}</h3>

      <h3>{{item.upduser}}</h3>
    </div>
    <!--
          <div class="col-lg-6" >.col-lg-6</div>
    -->
    <a v-link="{ name: 'user', params: { userId: 123 }}">User</a>
  </div>
  <br/>

  <div class="row show-grid">
    <div class="col-sm-3 col-md-push-9">
      <button class="btn btn-default" v-on:click="onCancelClick(item,$event)">返回</button>
    </div>
  </div>
  </div>
</template>

<script type="text/javascript" src="../../../node_modules/jquery/dist/jquery.js"></script>
<script src="../../../lib/bootstrap/3.3.5/js/bootstrap.min.js"></script>
<script src="../../../lib/vue-router/0.7.13/vue-router.min.js"></script>
<script src="../../../node_modules/vue/dist/vue.js"></script>
<script src="../../../node_modules/vue-resource/dist/vue-resource.js"></script>
<script src="user-v1.js"></script>
</body>
</html>
